<template>
  <div class="app-container">
    <div class="filter-container">
      <el-input v-model="listQuery.orderCode" clearable :placeholder="$t('order.orderCode')" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
      <el-input v-model="listQuery.typeNo" clearable :placeholder="$t('order.typeNo')" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
      <!-- 搜索按钮 -->
      <el-button v-waves class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="handleFilter">
        {{ $t('common.search') }}
      </el-button>
      <!-- 新建按钮 -->
      <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-plus" @click="handleCreate">
        {{ $t('common.creatNew') }}
      </el-button>
      <!-- 重置按钮 -->
      <el-button v-waves class="filter-item" type="primary" icon="el-icon-refresh" @click="handleReset">
        {{ $t('common.reset') }}
      </el-button>
      <!-- 从工厂服务器下载数据 -->
      <el-button
        v-if="editRight"
        v-waves
        class="filter-item"
        type="warning"
        icon="el-icon-download"
        @click="handleDownload"
      >
        {{ $t('produce.downloadList') }}
      </el-button>
      <transition name="fade">
        <el-button v-if="flag" class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-download" @click="saveList">
          {{ $t('common.save') }}
        </el-button>
      </transition>
      <el-checkbox v-model="checked" style="margin-left: 10px;" size="medium">
        {{ $t('common.openAll') }}
      </el-checkbox>
    </div>
    <!-- 主界面数据 -->
    <el-table
      ref="dragTable"
      v-loading="listLoading"
      row-key="orderId"
      :data="list"
      :header-row-style="{color: 'black'}"
      :header-cell-style="{background: 'lightBlue'}"
      :row-style="{height:'20px'}"
      :cell-style="{padding:'2px'}"
      border
      fit
      highlight-current-row
      style="width: 100%;"
      @sort-change="sortChange"
    >
      <el-table-column width="40px" align="center">
        <template>
          <span><i class="el-icon-rank" /></span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.orderCode')" width="120px" align="center">
        <template slot-scope="{row}">
          <span class="link-type" @click="goProduct(row.orderCode)">{{ row.orderCode }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.orderName')" width="120px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.orderName }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.orderStatus')" width="100px" align="center">
        <template slot-scope="{row}">
          <el-tag :type="orderStatus[row.orderStatus].color">{{ orderStatus[row.orderStatus].label }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.orderUnit')" width="*" align="center">
        <template slot-scope="{row}">
          <span>{{ row.orderUnit }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.orderNumber')" width="*" align="center">
        <template slot-scope="{row}">
          <span>{{ row.orderNumber }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.planStart')" width="200px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.planStart }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.planEnd')" width="200px" align="center">
        <template slot-scope="{row}">
          <span type="time">{{ row.planEnd }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('equipment.lineName')" width="150px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.lineNumber }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('produce.typeNo')" width="180px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.typeNo }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('equipment.manager')" width="120px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.manager }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('produce.creatTime')" width="220px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.creatTime }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.productDescription')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.matDesc }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('order.picNumberVer')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.matVer }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.bomCode')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.bomSetId }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.bomVer')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.bomSetVersion }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.processRoute')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.processingNumber }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.processRouteVer')" width="175px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.processingVer }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.sceneCode')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.cjcode }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.customerOrderNo')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.cusSo }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.customerOrderLine')" width="170px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.cusSoItem }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="checked" :label="$t('order.productDepartment')" width="160px" align="center">
        <template slot-scope="{row}">
          <span>{{ row.ownerCode }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('common.operation')" align="center" width="200px" class-name="small-padding fixed-width">
        <template slot-scope="{row,$index}">
          <el-button type="primary" size="mini" @click="handleUpdate(row)">
            {{ $t('common.edit') }}
          </el-button>
          <el-button size="mini" type="danger" @click="handleDelete(row,$index)">
            {{ $t('common.delete') }}
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    <div>
      <!-- gante图 -->
      <gant-chart :title="$t('order.orderGant')" :chart-data="gantData" />
    </div>
    <!-- 新建和更新对话框 -->
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
      <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="120px" style="width: 600px; margin-left:50px;">
        <el-form-item :label="$t('order.orderCode')" required prop="orderCode">
          <el-input v-model="temp.orderCode" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.orderName')">
          <el-input v-model="temp.orderName" />
        </el-form-item>
        <el-form-item :label="$t('order.orderStatus')" prop="orderStatus">
          <el-select v-model="temp.orderStatus" class="filter-item" style="width: 200px">
            <el-option v-for="(item,index) in orderStatus" :key="index" :label="item.label" :value="index" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('order.orderUnit')">
          <el-input v-model="temp.orderUnit" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.orderNumber')">
          <el-input v-model="temp.orderNumber" type="number" :min="0" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.planStart')" required>
          <el-date-picker v-model="date1" value-format="yyyy-MM-dd" class="filter-item" />
          <el-time-picker v-model="time1" value-format="HH:mm:ss" class="filter-item" />
        </el-form-item>
        <el-form-item :label="$t('order.planEnd')" required>
          <el-date-picker v-model="date2" value-format="yyyy-MM-dd" class="filter-item" />
          <el-time-picker v-model="time2" value-format="HH:mm:ss" class="filter-item" />
        </el-form-item>
        <el-form-item :label="$t('equipment.lineName')" required prop="orderStatus">
          <el-select v-model="temp.lineNumber" class="filter-item" style="width: 200px">
            <el-option v-for="item in lineOptions" :key="item.lineNumber" :label="item.lineName" :value="item.lineNumber" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('produce.typeNo')" required prop="typeNo">
          <el-input v-model="temp.typeNo" clearable />
        </el-form-item>
        <el-form-item :label="$t('equipment.manager')">
          <el-input v-model="temp.manager" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.productDescription')">
          <el-input v-model="temp.matDesc" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.picNumberVer')">
          <el-input v-model="temp.matVer" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.bomCode')">
          <el-input v-model="temp.bomSetId" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.bomVer')">
          <el-input v-model="temp.bomSetVersion" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.processRoute')">
          <el-input v-model="temp.processingNumber" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.processRouteVer')">
          <el-input v-model="temp.processingVer" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.sceneCode')">
          <el-input v-model="temp.cjcode" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.customerOrderNo')">
          <el-input v-model="temp.cusSo" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.customerOrderLine')">
          <el-input v-model="temp.cusSoItem" clearable />
        </el-form-item>
        <el-form-item :label="$t('order.productDepartment')">
          <el-input v-model="temp.ownerCode" clearable />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">
          {{ $t('common.cancel') }}
        </el-button>
        <el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">
          {{ $t('common.ok') }}
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { Table, TableColumn } from 'element-ui'
import Sortable from 'sortablejs'
import { getOrderList, creatOrder, updateOrder, deleteOrder, saveOrder, downloadOrderFromMes } from '@/api/order'
import { getLineList } from '@/api/equipment'
import { getTypeList } from '@/api/produce'
import waves from '@/directive/waves' // waves directive
import { parseTime } from '@/utils'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import GantChart from '@/components/Charts/GantChart' // secondary package based on el-pagination
import i18n from '@/lang'

export default {
  name: 'OrderSummary',
  components: {
    Pagination,
    GantChart,
    ElTable: Table,
    ElTableColumn: TableColumn
  },
  directives: { waves },
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'info',
        deleted: 'danger'
      }
      return statusMap[status]
    }
  },
  data() {
    return {
      flag: false,
      checked: false,
      editRight: true,
      list: [],
      date1: '',
      time1: '',
      date2: '',
      time2: '',
      lineOptions: [],
      typeOptions: [],
      gantData: {
        valueY: [],
        start: [],
        end: [],
        label: [] },
      // 任务u状态
      orderStatus: [
        { label: '已下达', key: 'REL', color: 'info' },
        { label: '生产中', key: 'RUNNING', color: 'warning' },
        { label: '已完成', key: 'FINISHED', color: 'success' },
        { label: '已锁定', key: 'LOCKED', color: 'danger' },
        { label: '已取消', key: 'CANCELED', color: 'danger' },
        { label: '已关闭', key: 'CLOSED', color: 'danger' }],
      total: 0,
      listLoading: true,
      lineNumber: '',
      listQuery: {
        page: 1,
        limit: 20,
        state: 0,
        orderCode: '',
        lineNumber: '',
        typeNo: '',
        startTime: parseTime(Date.now(), '{y}-{m}-{d} 00:00:00'),
        endTime: '',
        sort: '+due_date'
      },
      showReviewer: false,
      temp: {
        orderId: 0,
        orderCode: '',
        orderName: '',
        orderStatus: 0,
        orderUnit: '',
        planStart: Date.now(),
        planEnd: Date.now(),
        lineNumber: '',
        typeNo: '',
        matDesc: null,
        matVer: 0,
        creatTime: Date.now(),
        manager: '',
        orderNumber: 0,
        bomSetId: null,
        bomSetVersion: 0,
        processingNumber: null,
        processingVer: 0,
        cjcode: null,
        cusSo: null,
        cusSoItem: null,
        ownerCode: null
      },
      dialogFormVisible: false,
      dialogStatus: '',
      textMap: {
        update: i18n.t('common.edit'),
        create: i18n.t('common.creatNew')
      },
      dialogPvVisible: false,
      pvData: [],
      rules: {
        lineName: [{ required: true, message: i18n.t('msg.CAN_NOT_BE_NULL'), trigger: 'change' }],
        lineNumber: [{ required: true, message: i18n.t('msg.CAN_NOT_BE_NULL'), trigger: 'change' }],
        priority: [{ required: true, message: i18n.t('msg.CAN_NOT_BE_NULL'), trigger: 'change' }]
      },
      downloadLoading: false,
      searchLoading: {
        company: false,
        manager: false
      },
      sortable: null,
      newList: [],
      searchDialogStatus: '',
      searchDialogFormVisible: {
        company: false,
        manager: false
      }
    }
  },
  mounted() {
    this.setSort()
    this.$nextTick(() => {
      this.setSort()
    })
  },
  created() {
    this.lineNumber = this.$store.getters.lineNumber
    this.getLineList()
    this.getList()
    this.editRight = (this.$store.getters.roles === 'admin' || this.$store.getters.roles === 'administrator')
    // console.log(this.listQuery.lineNumber)
  },
  methods: {
    // 跳转到订单页面
    goProduct(orderCode) {
      this.$router.push({ name: 'PendingProductionOrder', params: { orderCode: orderCode }})
    },
    // 从服务器下载数据
    handleDownload() {
      this.$confirm(i18n.t('produce.downloadOrNot'), i18n.t('common.tip'), {
        confirmButtonText: i18n.t('common.confirm'),
        cancelButtonText: i18n.t('common.cancel'),
        type: 'warning'
      }).then(() => {
        this.listLoading = true
        downloadOrderFromMes(this.listQuery).then(response => {
          this.getList()
          this.$message({
            type: 'success',
            message: i18n.t('msg.DOWNLOAD_SUCCESS')
          })
          this.listLoading = false
        })
      })
    },
    // 重置input内容
    handleReset() {
      this.listQuery.orderCode = ''
      this.listQuery.typeNo = ''
    },
    formatDateTime(date) {
      return date.substring(0, 10)
    },
    // 保存订单
    saveList() {
      saveOrder(this.list).then(response => {
        this.$notify({
          title: this.$i18n.t('common.tip'),
          message: i18n.t('msg.SAVE_SUCCESS'),
          type: 'success',
          duration: 2000
        })
        this.flag = false
      })
    },
    // 行拖拽
    setSort() {
      const el = this.$refs.dragTable.$el.querySelectorAll(
        '.el-table__body-wrapper > table > tbody'
      )[0]
      this.sortable = Sortable.create(el, {
        ghostClass: 'sortable-ghost',
        animation: 150,
        setData: function(dataTransfer) {
          dataTransfer.setData('Text', '')
          console.log(1)
        },
        onMove: (evt) => {
          if (evt.dragged.rowIndex === 0 || evt.related.rowIndex === 0) {
            if (this.list[0].orderStatus === 1) return false
          }
        },
        onEnd: evt => {
          const targetRow = this.list.splice(evt.oldIndex, 1)[0]
          this.list.splice(evt.newIndex, 0, targetRow)
          const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]
          this.newList.splice(evt.newIndex, 0, tempIndex)
          this.flag = true
        }
      })
    },
    // 获取甘特图数据
    getGantData() {
      this.gantData.valueY = []
      this.gantData.start = []
      this.gantData.end = []
      this.gantData.label = []
      this.list.forEach(item => {
        this.gantData.valueY.push(item.orderCode)
        this.gantData.start.push(item.planStart)
        this.gantData.end.push(item.planEnd)
        this.gantData.label.push(this.orderNumber)
      })
    },
    // 获取清单
    getList() {
      this.listLoading = true
      getOrderList(this.listQuery).then(response => {
        this.list = response.data.orders
        this.total = response.data.total
        this.listLoading = false
        this.getGantData()
      })
    },
    handleLineSelect() {
      this.listQuery.lineNumber = this.temp.lineNumber
      this.typeOptions = []
      getTypeList(this.listQuery).then(response => {
        this.typeOptions = response.data.types
        this.listQuery.lineNumber = ''
      })
    },
    // 获取线体清单
    getLineList() {
      this.listLoading = true
      getLineList(this.listQuery).then(response => {
        console.log(response)
        this.lineOptions = response.data.lines
        this.listLoading = false
      })
    },
    // 查看错误信息
    handleCheck(row) {
      const ret = Object.assign({}, row) // copy obj
      if (ret.errMsg === null | '') {
        return
      }
      this.$msgbox({
        message: ret.errMsg,
        type: 'error'
      })
    },
    // 点击搜索时获取清单
    handleFilter() {
      this.listQuery.page = 1
      this.getList()
    },
    // 排序时调用
    sortChange(data) {
      const { prop, order } = data
      if (prop === 'startDate') {
        this.sortByCreatTime(order)
      } else if (prop === 'dueDate') {
        this.sortBydueDate(order)
      } else if (prop === 'priority') {
        this.sortByPriority(order)
      }
    },
    // 根据创建时间排序
    sortByCreatTime(order) {
      if (order === 'ascending') {
        this.listQuery.sort = '+start_date'
      } else {
        this.listQuery.sort = '-start_date'
      }
      this.handleFilter()
    },
    // 根据交期排序
    sortBydueDate(order) {
      if (order === 'ascending') {
        this.listQuery.sort = '+due_date'
      } else {
        this.listQuery.sort = '-due_date'
      }
      this.handleFilter()
    },
    // 根据优先级
    sortByPriority(order) {
      if (order === 'ascending') {
        this.listQuery.sort = '+priority'
      } else {
        this.listQuery.sort = '-priority'
      }
      this.handleFilter()
    },
    // 初始化创建信息
    resetTemp() {
      this.date1 = ''
      this.time1 = ''
      this.date2 = ''
      this.time2 = ''
      this.temp = {
        orderId: 0,
        orderCode: '',
        orderName: '',
        orderStatus: 0,
        orderUnit: '',
        planStart: '',
        planEnd: '',
        lineNumber: '',
        typeNo: '',
        matDesc: null,
        matVer: 0,
        manager: '',
        orderNumber: 0,
        bomSetId: null,
        bomSetVersion: 0,
        processingNumber: null,
        processingVer: 0,
        cjcode: null,
        cusSo: null,
        cusSoItem: null,
        ownerCode: null
      }
    },
    // 新建一条线体
    handleCreate() {
      this.resetTemp()
      this.dialogStatus = 'create'
      this.dialogFormVisible = true
      this.temp.manager = this.$store.getters.name
      this.$nextTick(() => {
        this.$refs['dataForm'].clearValidate()
      })
    },
    // 创建数据
    createData() {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          this.temp.planStart = this.date1 + ' ' + this.time1
          this.temp.planEnd = this.date2 + ' ' + this.time2
          creatOrder(this.temp).then(response => {
            this.list.unshift(response.data)
            this.dialogFormVisible = false
            this.$notify({
              title: this.$i18n.t('common.tip'),
              message: i18n.t('msg.CREAT_SUCCESS'),
              type: 'success',
              duration: 2000
            })
            this.getList()
          })
        }
      })
    },
    // 点击编辑按钮
    handleUpdate(row) {
      this.temp = Object.assign({}, row) // copy obj
      this.dialogStatus = 'update'
      this.dialogFormVisible = true
      this.date1 = this.temp.planStart.substring(0, 10)
      this.time1 = this.temp.planStart.substring(this.temp.planStart.length - 8, this.temp.planStart.length)
      this.date2 = this.temp.planEnd.substring(0, 10)
      this.time2 = this.temp.planEnd.substring(this.temp.planEnd.length - 8, this.temp.planEnd.length)
      this.$nextTick(() => {
        this.$refs['dataForm'].clearValidate()
      })
    },
    // 更新数据到数据库
    updateData() {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          this.temp.planStart = this.date1 + ' ' + this.time1
          this.temp.planEnd = this.date2 + ' ' + this.time2
          updateOrder(this.temp).then(response => {
            const index = this.list.findIndex(v => v.orderId === this.temp.orderId)
            this.list.splice(index, 1, response.data)
            this.dialogFormVisible = false
            this.$notify({
              title: this.$i18n.t('common.tip'),
              message: i18n.t('msg.UPDATE_SUCCESS'),
              type: 'success',
              duration: 2000
            })
            this.getList()
          })
        }
      })
    },
    // 删除数据库信息
    handleDelete(row, index) {
      this.$confirm(i18n.t('msg.DELET_INFO_CONFIRM'), i18n.t('common.warn'), {
        confirmButtonText: i18n.t('common.confirm'),
        cancelButtonText: i18n.t('common.cancel'),
        type: 'warning'
      })
        .then(async() => {
          this.temp = Object.assign({}, row) // copy obj
          if (this.temp.orderStatus === 1) {
            this.$notify({
              title: this.$i18n.t('common.tip'),
              message: i18n.t('msg.DELET_FAILED'),
              type: 'warning',
              duration: 2000
            })
            return
          }
          deleteOrder(this.temp).then(() => {
            this.$notify({
              title: this.$i18n.t('common.tip'),
              message: i18n.t('msg.DELET_SUCCESS'),
              type: 'success',
              duration: 2000
            })
            this.list.splice(index, 1)
            this.getList()
          })
        })
        .catch(err => { console.error(err) })
    },
    // 下载所有导出信息
    // handleDownload() {
    //   this.downloadLoading = true
    //   import('@/vendor/Export2Excel').then(excel => {
    //     const tHeader = ['项目号', '公司代号', '描叙', '优先级', '负责人', '启动', '交期', '状态', '创建时间', '备注']
    //     const filterVal = ['projectNo', 'companyCode', 'description', 'priority', 'manager', 'startDate',
    //       'dueDate', 'state', 'creatTime', 'remark']
    //     const data = this.formatJson(filterVal)
    //     excel.export_json_to_excel({
    //       header: tHeader,
    //       data,
    //       filename: '项目清单'
    //     })
    //     this.downloadLoading = false
    //   })
    // },
    // 过滤相关信息
    formatJson(filterVal) {
      return this.list.map(v => filterVal.map(j => {
        if (j === 'timestamp') {
          return parseTime(v[j])
        } else {
          return v[j]
        }
      }))
    }
  }
}
</script>
<style>

.sortable-ghost {
  opacity: 0.9;
  color: #fff !important;
  background: #b143e0 !important;
}

</style>
<style lang="scss" scoped>

.fade-enter-active {
  transition: opacity 2s;
}
.icon-star {
  margin-right: 2px;
}
.drag-handler {
  width: 20px;
  height: 20px;
  cursor: pointer;
}
.show-d {
  margin-top: 15px;
}

.dashboard-editor-container {
  padding: 32px;
  height: 800px;
  background-color: white;
  position: relative;

  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px x0;
    //margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
